package org.osoftware.mumi.dao.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


/**
 * The Class City.
 */
@Entity
@Table(name="city")
public class City extends BaseObject{
	
	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 2699269844915304387L;
	
	/** The name. */
	@Column(name="name")
	private String name;
	
	/** The region. */
	@ManyToOne
    @JoinColumn(name = "region_id", updatable = false, insertable = false, nullable=false)
	private Region region;
	
	/**
	 * Gets the name.
	 *
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * Sets the name.
	 *
	 * @param name the new name
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * Gets the region.
	 *
	 * @return the region
	 */
	public Region getRegion() {
		return region;
	}
	
	/**
	 * Sets the region.
	 *
	 * @param region the new region
	 */
	public void setRegion(Region region) {
		this.region = region;
	}

	/* (non-Javadoc)
	 * @see org.osoftware.mumi.dao.model.BaseObject#toString()
	 */
	@Override
	public String toString() {
		return "City [name=" + name + ", region=" + (region != null? region.getName(): "NONE") + ", toString()="
				+ super.toString() + "]";
	}
	
	
}
